const express = require('express')
const path = require('path')
const app = express()
// app.use(express.static(path.join(__dirname,'./public')))
app.use('/static/',express.static(path.join(__dirname,'./public')))
app.get('/',(req,res,next)=>{
    // console.log('请求过来了');
    // console.log(req);
    // console.log(req.app)
    console.log(req.url)
    console.log(req.baseUrl)
    console.log(req.cookies)
    console.log(req.hostname)
    console.log(req.originalUrl)
    console.log(req.path)
    console.log(req.protocol)
    console.log(req.route)
    console.log(req.params)
    console.log(req.is())
    // res.send('this is a response text')
    // res.send('你好')
    console.log('访问的是/');
    next()
})

app.get('/abc/dddd',(req,res,next)=>{
    console.log('/abc/dddd');
})



let server = app.listen(3000,'127.0.0.1',()=>{
    let host = server.address().address
    let port = server.address().port
    console.log(`App is running ${host} on port ${port}`);
})











